#define _CRT_SECURE_NO_WARNINGS 1

#include"AVL_Tree.h"


void Test_AVL_Tree1()
{
	AVL_Tree<int, int> T;

	//int a[] = { 4,2,6,1,3,5,15,7,16,14 };
	int a[] = { 16,3,7,11,9,26,18,14,15 };

	for (auto e : a)
	{
		T.Insert({ e,e });
		cout << e << "->" << T.Is_BalanceTree() << endl;
	}
	T.Inorder();

	cout << T.Is_BalanceTree() << endl;
}

void Test_AVL_Tree()
{
	const int N = 300000;
	vector<int> v;
	v.reserve(N);
	srand(time(0));
	for (size_t i = 0; i < N; i++)
	{
		v.push_back(rand() + i);
	}
	size_t begin2 = clock();
	AVL_Tree<int, int> t;

	for (auto e : v)
	{
		//cout << t.Is_BalanceTree() << endl;

		t.Insert(make_pair(e, e));
	}
	size_t end2 = clock();
	cout << "Insert:" << end2 - begin2 << endl;
	cout << t.Is_BalanceTree() << endl;
	cout << "Height:" << t.Height() << endl;
	cout << "Size:" << t.Size() << endl;
}

int main()
{
	Test_AVL_Tree();

	return 0;
}


